<%@page import="com.maoye.ossp.sys.site.utils.MenuUtils"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ page import="java.util.List"%>
<%@ page import="com.maoye.ossp.sys.site.entity.SiteNavMenu"%>
<%@ page import="com.maoye.ossp.sys.site.utils.MenuUtils"%>
<%@ taglib prefix="decorator"
	uri="http://www.opensymphony.com/sitemesh/decorator"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title><decorator:title /> - 茂业运营支撑平台</title>
<%@include file="/WEB-INF/views/include/head.jsp"%>
<link href="${staticPath}/css/layout.css" type="text/css"
	rel="stylesheet" />
<script type="text/javascript" src="${staticPath}/js/ossp-sys.js"></script>
<decorator:head />
</head>
<body>
	<%@include file="/WEB-INF/views/include/navbar.jsp" %>
	<div id="wrapper">
		<div class="container o-main-container Projection">
			<div class="row">
				<div class="col-sm-3">
					<div id="leftbar">
							<div class="panel-group" id="accordion">
							<%
								String currentNavId = request.getParameter("navId");
								List<SiteNavMenu> menuList = MenuUtils.getMenuListByNavId(currentNavId);
								int k = 0;
								for(int i=0;i<menuList.size();i++){
									k++;
									SiteNavMenu menu = menuList.get(i);
								
							%>
							<% if(menu.getPermission()!=null&&!menu.getPermission().equals("")){
							 %>
							<shiro:hasPermission name="<%=menu.getPermission()%>">
							<div class="panel panel-default">
                                <div class="panel-heading">
                                  <h4 class="panel-title">
                                  	<a data-toggle="collapse" href="#collapse<%=k%>" class="content-plus"><%=menu.getName()%></a>
                                  </h4>
                                </div>
                                <div id="collapse<%=k%>" class="panel-collapse collapse in">
                                  <div class="panel-body">
                                      <ul class="sidebar_1">
                                      		<% 
												List<SiteNavMenu> chidren = menu.getChidren();
												for(int j=0;j<chidren.size();j++){
													SiteNavMenu chidrenMenu = chidren.get(j);
													if(chidrenMenu.getPermission()!=null&& !chidrenMenu.getPermission().equals(""))
													  { 
											%>
											<shiro:hasPermission name="<%=chidrenMenu.getPermission()%>">
                                            <li><a href="${contextPath}/menu/${navId}-<%=chidrenMenu.getId()%>.html" target="<%=chidrenMenu.getTarget()%>" title=""><%=chidrenMenu.getName()%></a></li>
                                            </shiro:hasPermission>
                                            <%
													  }
													}
											%>
                                      </ul>
                                  </div>
                                </div>
                              </div>
                             </shiro:hasPermission>
                             <% }%>
							<%
								}
							%>
						</div>
					</div>
				</div>
				<div class="col-sm-9">
					<decorator:body />
				</div>
			</div>
			<div class="footer">版权所有 © 茂業國際控股有限公司 粤ICP备07033766号</div>
		</div>
	</div>
	<script type="text/javascript">
		$(document).ready(function() {
			//resizeLBHeight();
			$(window).resize(function() {
				//resizeLBHeight();
			});
			$("#chevronDownBtn").click(function(){
				if(!$("#statement-search-builder").is(":hidden") ){
					 $("#glyphiconspan").removeClass('glyphicon glyphicon-chevron-up').addClass('glyphicon glyphicon-chevron-down');
				   }
				else
					{
				     $("#glyphiconspan").removeClass('glyphicon glyphicon-chevron-down').addClass('glyphicon glyphicon-chevron-up');
					}
				});
			$('[data-p-id]').each(function (){
				$("#"+$(this).attr("data-p-id")).addClass("active");
			});
			$('.collapse').on('hide.bs.collapse', function () {
			  	var id = $(this).attr('id');
				$('a[href="#'+id+'"]').removeClass("content-plus").addClass("content-minus");
			});
			$('.collapse').on('show.bs.collapse', function () {
			  	var id = $(this).attr('id');
				$('a[href="#'+id+'"]').removeClass("content-minus").addClass("content-plus");
			});
		});
		function resizeLBHeight() {
			var wWidth = $(window).width();
			var dHeight = $(document).height();
			var wHeight = $(window).height();
			var bHeight = $("#leftbar").height();
			if (wWidth > 768) {
				dHeight = (dHeight > wHeight) ? dHeight : wHeight;
				if (dHeight > bHeight) {
					$("#leftbar").height(dHeight - 110)
				}
			} else {
				$("#leftbar").height($("#module-menu").height() + 10)
			}
		}
	</script>
</body>
</html>